<?php

$_language->read_module('sponsors');
$mainsponsors=safe_query("SELECT * FROM ".PREFIX."sponsors WHERE (displayed = '1' AND mainsponsor = '1') ORDER BY sort");
if(mysql_num_rows($mainsponsors)) {
	
	if(mysql_num_rows($mainsponsors) == 1) $main_title = $_language->module['mainsponsor'];
	else $main_title = $_language->module['mainsponsors'];
	echo '<b>'.$main_title.'</b><br />';
	
	while($da=mysql_fetch_array($mainsponsors)) {
		if(!empty($da['banner_small'])) $sponsor='<img src="images/sponsors/'.$da['banner_small'].'" style="margin:2px 0;" border="0" alt="'.htmlspecialchars($da['name']).'" title="'.htmlspecialchars($da['name']).'" />';
		else $sponsor=$da['name'];
		$sponsorID = $da['sponsorID'];
		
		eval ("\$sc_sponsors_main = \"".gettemplate("sc_sponsors_main")."\";");
		echo $sc_sponsors_main;
	}
}

$sponsors=safe_query("SELECT * FROM ".PREFIX."sponsors WHERE (displayed = '1' AND mainsponsor = '0') ORDER BY sort");
if(mysql_num_rows($sponsors)) {
	
	if(mysql_num_rows($sponsors) == 1) $title = $_language->module['sponsor'];
	else $title = $_language->module['sponsors'];
	echo '<b>'.$title.'</b><br />';
	
	while($db=mysql_fetch_array($sponsors)) {
		if(!empty($db['banner_small'])) $sponsor='<img src="images/sponsors/'.$db['banner_small'].'" style="margin:2px 0;" border="0" alt="'.htmlspecialchars($db['name']).'" title="'.htmlspecialchars($db['name']).'" />';
		else $sponsor=$db['name'];
		$sponsorID = $db['sponsorID'];
		
		eval ("\$sc_sponsors = \"".gettemplate("sc_sponsors")."\";");
		echo $sc_sponsors;
	}
}

?>